Skip to content

Conversation

@cjgillot
Copy link
Contributor

@cjgillot cjgillot commented Sep 21, 2025

JumpThreading tries to avoid threading through loop headers to avoid creating irreducible CFGs.

However, computing dominators is expensive, and accounts up to 20 % of the runtime of the JumpThreading pass for some cases like serde.

This PR proposes to approximate according to the post-order traversal order. We define a "maybe" loop header as a block which is visited after its predecessor in post-order.

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Sep 21, 2025
@cjgillot
Copy link
Contributor Author

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rust-bors

This comment has been minimized.

rust-bors bot added a commit that referenced this pull request Sep 21, 2025
JumpThreading: Avoid computing dominators to identify loop headers.
@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Sep 21, 2025
@rust-bors
Copy link

rust-bors bot commented Sep 21, 2025

☀️ Try build successful (CI)
Build commit: a055c23 (a055c23b64184e483c6cd8de31e2cf3f87d4e410, parent: dd7fda570040e8a736f7d8bc28ddd1b444aabc82)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (a055c23): comparison URL.

Overall result: ✅ improvements - no action needed

Benchmarking this pull request means it may be perf-sensitive – we'll automatically label it not fit for rolling up. You can override this, but we strongly advise not to, due to possible changes in compiler perf.

@bors rollup=never
@rustbot label: -S-waiting-on-perf -perf-regression

Instruction count

Our most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-0.2% [-0.2%, -0.1%] 2
Improvements ✅
(secondary)
-0.2% [-0.2%, -0.2%] 2
All ❌✅ (primary) -0.2% [-0.2%, -0.1%] 2

Max RSS (memory usage)

Results (primary -2.7%, secondary 2.2%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
2.2% [2.2%, 2.2%] 1
Improvements ✅
(primary)
-2.7% [-2.7%, -2.7%] 1
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -2.7% [-2.7%, -2.7%] 1

Cycles

This benchmark run did not return any relevant results for this metric.

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 472.936s -> 470.628s (-0.49%)
Artifact size: 389.95 MiB -> 389.92 MiB (-0.01%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Sep 21, 2025
@cjgillot cjgillot marked this pull request as ready for review September 21, 2025 14:41
@rustbot
Copy link
Collaborator

rustbot commented Sep 21, 2025

Some changes occurred to MIR optimizations

cc @rust-lang/wg-mir-opt

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Sep 21, 2025
@rustbot rustbot removed the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Sep 21, 2025
@rustbot
Copy link
Collaborator

rustbot commented Sep 21, 2025

r? @lcnr

rustbot has assigned @lcnr.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@lcnr
Copy link
Contributor

lcnr commented Sep 26, 2025

r? wg-mir-opt

@rustbot rustbot assigned dianqk and unassigned lcnr Sep 26, 2025
@cjgillot cjgillot force-pushed the jump-threading-loop-dominator branch from 33ff3be to d13a5b0 Compare September 26, 2025 20:46
@rustbot
Copy link
Collaborator

rustbot commented Sep 26, 2025

This PR was rebased onto a different master commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

Copy link
Member

@dianqk dianqk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dianqk
Copy link
Member

dianqk commented Sep 27, 2025

@bors r+

@bors
Copy link
Collaborator

bors commented Sep 27, 2025

📌 Commit d13a5b0 has been approved by dianqk

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Sep 27, 2025
@bors
Copy link
Collaborator

bors commented Sep 27, 2025

⌛ Testing commit d13a5b0 with merge ade8487...

@bors
Copy link
Collaborator

bors commented Sep 27, 2025

☀️ Test successful - checks-actions
Approved by: dianqk
Pushing ade8487 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Sep 27, 2025
@bors bors merged commit ade8487 into rust-lang:master Sep 27, 2025
11 checks passed
@rustbot rustbot added this to the 1.92.0 milestone Sep 27, 2025
@github-actions
Copy link
Contributor

What is this? This is an experimental post-merge analysis report that shows differences in test outcomes between the merged PR and its parent PR.

Comparing 959b450 (parent) -> ade8487 (this PR)

Test differences

No test diffs found

Test dashboard

Run

cargo run --manifest-path src/ci/citool/Cargo.toml -- \
    test-dashboard ade84871f718ea20a6460d28e82290353b4bf3d2 --output-dir test-dashboard

And then open test-dashboard/index.html in your browser to see an overview of all executed tests.

Job duration changes

  1. aarch64-apple: 6284.6s -> 4566.8s (-27.3%)
  2. tidy: 227.0s -> 179.4s (-21.0%)
  3. dist-x86_64-apple: 5724.3s -> 6779.2s (18.4%)
  4. x86_64-gnu-llvm-20: 2979.2s -> 2443.5s (-18.0%)
  5. i686-gnu-2: 6534.5s -> 5451.0s (-16.6%)
  6. i686-gnu-1: 8371.2s -> 7018.3s (-16.2%)
  7. x86_64-gnu-distcheck: 7360.6s -> 6281.3s (-14.7%)
  8. dist-aarch64-apple: 7095.8s -> 6149.4s (-13.3%)
  9. aarch64-gnu-llvm-20-2: 2468.9s -> 2150.3s (-12.9%)
  10. pr-check-2: 2748.7s -> 2398.7s (-12.7%)
How to interpret the job duration changes?

Job durations can vary a lot, based on the actual runner instance
that executed the job, system noise, invalidated caches, etc. The table above is provided
mostly for t-infra members, for simpler debugging of potential CI slow-downs.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (ade8487): comparison URL.

Overall result: ❌✅ regressions and improvements - please read the text below

Our benchmarks found a performance regression caused by this PR.
This might be an actual regression, but it can also be just noise.

Next Steps:

  • If the regression was expected or you think it can be justified,
    please write a comment with sufficient written justification, and add
    @rustbot label: +perf-regression-triaged to it, to mark the regression as triaged.
  • If you think that you know of a way to resolve the regression, try to create
    a new PR with a fix for the regression.
  • If you do not understand the regression or you think that it is just noise,
    you can ask the @rust-lang/wg-compiler-performance working group for help (members of this group
    were already notified of this PR).

@rustbot label: +perf-regression
cc @rust-lang/wg-compiler-performance

Instruction count

Our most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
0.3% [0.3%, 0.3%] 1
Improvements ✅
(primary)
-0.2% [-0.3%, -0.2%] 2
Improvements ✅
(secondary)
-0.2% [-0.3%, -0.2%] 2
All ❌✅ (primary) -0.2% [-0.3%, -0.2%] 2

Max RSS (memory usage)

Results (primary 0.5%, secondary 2.7%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
2.4% [2.4%, 2.4%] 1
Regressions ❌
(secondary)
2.7% [2.7%, 2.7%] 1
Improvements ✅
(primary)
-1.3% [-1.3%, -1.3%] 1
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.5% [-1.3%, 2.4%] 2

Cycles

Results (secondary -2.7%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-2.7% [-2.7%, -2.7%] 1
All ❌✅ (primary) - - 0

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 472.089s -> 469.268s (-0.60%)
Artifact size: 388.09 MiB -> 388.12 MiB (0.01%)

@rustbot rustbot added the perf-regression Performance regression. label Sep 27, 2025
@cjgillot cjgillot deleted the jump-threading-loop-dominator branch September 27, 2025 13:57
@Mark-Simulacrum Mark-Simulacrum removed the perf-regression Performance regression. label Sep 29, 2025
@Mark-Simulacrum
Copy link
Member

Regression is just bimodality.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merged-by-bors This PR was explicitly merged by bors. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants